<template>

	<view class="cardItem" >
		<view class="cardItem_top">
			<view class="cardItem_top_right">
				<view class="cardItem_top_right_btn"
					:style='this.colorordersStatusType(Number(orderObj.extraProjectStatus?orderObj.extraProjectStatus:1))'>
					{{orderPaystatusArray[orderObj.extraProjectStatus?orderObj.extraProjectStatus:1]}}
				</view>
				<view class="cardItem_top_right_btn"
					:style='this.enterRetaultStatusType(Number(orderObj.resultEntryStatus?orderObj.resultEntryStatus:1))'>
					{{enterRetaultStatusArray[orderObj.resultEntryStatus?orderObj.resultEntryStatus:1]}}
				</view>
			
			</view>
			<view class="cardItem_top_left" v-if="title">
                 <view class="cardItem_top_left_btn" @tap="goToExtroOrderDetail(orderObj)">
                 	{{title}}
                 </view>
			</view>
			
		</view>
		<view class="cardItem_price" style="margin-top:6rpx;">
			<text v-if="orderObj.amount" style="margin-right:16rpx;">
				总费用<text class='redPrice' >{{orderObj.amount}}</text>元
			</text>
			<text >医嘱数 <text class='redPrice'>{{orderObj.doctorAdviceNumber}}</text> </text>
		</view>
		<view class="cardItem_infosContaines">
			<view class="cardItem_infosContaines_content">
				<view class="cardItem_infosContaines_content_item">
					<view class="cardItem_infosContaines_content_item_label ">
						申请日期
					</view>
					<view class="cardItem_infosContaines_content_item_title">
						{{orderObj.createTime}}
					</view>
				</view>
				<view class="cardItem_infosContaines_content_item">
					<view class="cardItem_infosContaines_content_item_label ">
						订单ID
					</view>
					<view class="cardItem_infosContaines_content_item_title">
						{{orderObj.id}}
					</view>
				</view>
				<view class="cardItem_infosContaines_content_item">
					<view class="cardItem_infosContaines_content_item_label ">
						订单号
					</view>
					<view class="cardItem_infosContaines_content_item_title">
						{{orderObj.orderNumber}}
					</view>
				</view>
				<view class="cardItem_infosContaines_content_item" v-if="orderObj.typeOfConsultationName">
					<view class="cardItem_infosContaines_content_item_label ">
						会诊类别
					</view>
					<view class="cardItem_infosContaines_content_item_title">
						{{orderObj.typeOfConsultationName}}
					</view>
				</view>
				<view class="cardItem_infosContaines_content_item" v-if="orderObj&&orderObj.patients">
					<view class="cardItem_infosContaines_content_item_label ">
						患者信息
					</view>
					<view class="cardItem_infosContaines_content_item_title_infos">
						<view class="cardItem_infosContaines_content_item_title_infos_name">
							{{orderObj.patients[0].name}}
						</view>
						<view class="cardItem_infosContaines_content_item_title_infos_line"
							v-if="orderObj.patients[0].sexName">

						</view>
						<view class="cardItem_infosContaines_content_item_title_infos_name"
							v-if="orderObj.patients[0].sexName">
							{{orderObj.patients[0].sexName}}
						</view>
						<view class="cardItem_infosContaines_content_item_title_infos_line"
							v-if="orderObj.patients[0].age">

						</view>
						<view class="cardItem_infosContaines_content_item_title_infos_name"
							v-if="orderObj.patients[0].age">
							{{orderObj.patients[0].age}}
						</view>
						<view class="cardItem_infosContaines_content_item_title_infos_line"
							v-if="orderObj.patients[0].cellphone">

						</view>
						<view class="cardItem_infosContaines_content_item_title_infos_name"
							v-if="orderObj.patients[0].cellphone">
							{{orderObj.patients[0].cellphone}}
						</view>
					</view>
				</view>
				<view class="cardItem_infosContaines_content_item" v-if="orderObj.orderType==1">
					<view class="cardItem_infosContaines_content_item_label ">
						送检信息
					</view>
					<view class="cardItem_infosContaines_content_item_title_infos">
						<view class="cardItem_infosContaines_content_item_title_infos_name">
							{{orderObj.sendingHospitalName}}
						</view>
						<view class="cardItem_infosContaines_content_item_title_infos_line"
							v-if="orderObj.sendingDoctor">

						</view>
						<view class="cardItem_infosContaines_content_item_title_infos_name"
							v-if="orderObj.sendingDoctor">
							{{orderObj.sendingDoctor}}
						</view>
						<view class="cardItem_infosContaines_content_item_title_infos_tag tag4">
							机构申请
						</view>
					</view>
				</view>
				<view class="cardItem_infosContaines_content_item" v-else>
					<view class="cardItem_infosContaines_content_item_label ">
						送检信息
					</view>
					<view class="cardItem_infosContaines_content_item_title_infos">
						<view class="cardItem_infosContaines_content_item_title_infos_name">
							个人申请
						</view>
						<view class="cardItem_infosContaines_content_item_title_infos_tag tag3" v-if="orderObj.ningboOrderType == 3">
							特需会诊
						</view>
						<view class="cardItem_infosContaines_content_item_title_infos_tag tag2" v-else-if="orderObj.ningboOrderType == 2">
							项目检测
						</view>
						<view class="cardItem_infosContaines_content_item_title_infos_tag tag1" v-else>
							普通会诊
						</view>
					</view>
				</view>
				<view class="cardItem_infosContaines_content_item">
					<view class="cardItem_infosContaines_content_item_label ">
						会诊信息
					</view>
					<view class="cardItem_infosContaines_content_item_title_infos">
						<view class="cardItem_infosContaines_content_item_title_infos_name">
							{{orderObj.serviceCenterName}}
						</view>
						<view class="cardItem_infosContaines_content_item_title_infos_line"
							v-if="getexpertName(orderObj)">

						</view>
						<view class="cardItem_infosContaines_content_item_title_infos_name"
							v-if="getexpertName(orderObj)">
							{{getexpertName(orderObj)}}
						</view>
					</view>
				</view>
			</view>
		</view>

	</view>

</template>

<script>
	import {
		serviceStatusMap,
		ningboOrderTypeMap,
		ordersStatusMap
	} from '@/utils/baseData.js'
	export default {
		name: "orderItem",
		props: ['orderObj',  'itemIndex', 'btnGroupArr','title'], //entranceType  1:专家介绍进入 2:特需会诊进入
		data() {
			return {
				ningboOrderTypeMap: ningboOrderTypeMap,
				orderPaystatusArray: {
					1: '未支付',
					2: '部分支付',
					3: '已支付',
				},
				enterRetaultStatusArray: {
					1: '未录入',
					2: '部分录入',
					3: '已录入',
				},
			}

		},
		created() {

		},
		methods: {
			goToExtroOrderDetail(item){
				uni.navigateTo({
					url: `/subPackages/doctor/extroAddDetail/extroAddDetail?id=${item.id}`
				})
			},
			getexpertName(item) {
				if (item && item.patients[0]) {
					if (item.patients[0].expertDiagnosis && item.patients[0].expertDiagnosis[0]) {
						return item.patients[0].expertDiagnosis[0].expertName
					} else {
						return ''
					}
				} else {
					return ''
				}
			},
			colorordersStatusType(item) {
				switch (item) {
					case 3:
						return {
							'background-color': '#f0f9eb', 'border-color': '#e1f3d8', color: '#67c23a'
						} //success
					case 2:
						return {
							'background-color': '#fdf6ec', 'border-color': '#faecd8', color: '#e6a23c'
						} //danger
					case 1:
						return {
							'background-color': '#fef0f0', 'border-color': '#fde2e2', color: '#f56c6c'
						} //success
					default:
						return {
							'background-color': '#fef0f0', 'border-color': '#fde2e2', color: '#f56c6c'
						} //success
				}
			},
			enterRetaultStatusType(item) {
				switch (item) {
					case 3:
						return {
							'background-color': '#f0f9eb', 'border-color': '#e1f3d8', color: '#67c23a'
						} //success
					case 2:
						return {
							'background-color': '#fdf6ec', 'border-color': '#faecd8', color: '#e6a23c'
						} //danger
					case 1:
						return {
							'background-color': '#fef0f0', 'border-color': '#fde2e2', color: '#f56c6c'
						} //success
					default:
						return {
							'background-color': '#fef0f0', 'border-color': '#fde2e2', color: '#f56c6c'
						} //success
				}
			},

		}
	}
</script>

<style lang="scss" scoped>
	.redPrice {
		font-size: 28rpx;
		margin:0 4rpx;
		color: red;
	}

	.color0 {
		background: linear-gradient(180deg, #5DDFFA 0%, #1E68E3 100%);
		color: #ffffff;
		background-clip: text;
		font-weight: 700;
		-webkit-background-clip: text;
		-webkit-text-fill-color: transparent;
		display: inline-block;
	}

	.color1 {
		background: linear-gradient(180deg, #4CE4D5 0%, #0FB6D2 100%);
		color: #ffffff;
		background-clip: text;
		font-weight: 700;
		-webkit-background-clip: text;
		-webkit-text-fill-color: transparent;
		display: inline-block;

	}

	.color2 {
		background: linear-gradient(180deg, #74ADFE 0%, #7E61EF 99%);
		color: #ffffff;
		font-weight: 700;
		background-clip: text;
		-webkit-background-clip: text;
		-webkit-text-fill-color: transparent;
		display: inline-block;

	}

	.color3 {
		background: linear-gradient(180deg, #4CE4D5 0%, #0FB6D2 100%);
		color: #ffffff;
		background-clip: text;
		font-weight: 700;
		-webkit-background-clip: text;
		-webkit-text-fill-color: transparent;
		display: inline-block;
	}

	.cardItem.first {
		margin-top: 0rpx;
	}

	.cardItem {
		position: relative;
		margin: 0 10rpx;
		padding: 16rpx 12rpx;
		box-shadow: 2rpx 2rpx 8rpx 8rpx rgba(32, 108, 228, 0.3);
		border-radius: 8rpx;
		margin-top: 48rpx;
		color: rgba(51, 51, 51, 1);

		&_top {
			display: flex;
			align-items: center;
			justify-content: space-between;
             line-height: 56rpx;
			&_left {
				display: flex;
				align-items: center;

				&_btn {
					cursor: pointer;
					padding: 2rpx 16rpx;
					height: 48rpx;
					font-size: 26rpx;
					line-height: 42rpx;
					border: 2rpx solid #266EFF;
					border-radius: 6rpx;
					color: #266EFF;
				}
			}

			&_right {
				display: flex;
				align-items: center;

				&_btn {
					padding: 0 6rpx;
					border-radius: 6rpx;
					margin-right: 8rpx;
					font-size: 26rpx;
					line-height: 40rpx;
					transform: scale(0.9);
					border: 2rpx solid #fff;
				}

				&_btn:last-child {
					margin: 0rpx;
				}

			}
		}

		&_price {
			color: rgba(42, 139, 239, 1);
			font-size: 28rpx;
			line-height: 40rpx;
			padding-left: 12rpx;
		}

		&_infosContaines {
			padding: 20rpx 12rpx;
            font-size:26rpx;
			&_content {
				border-top: 2rpx solid rgba(197, 197, 197, 1);
				padding-top: 20rpx;

				&_item:first-child {
					margin-top: 0rpx;
				}

				&_item {
					margin-top: 10rpx;
					display: flex;
					font-size: 26rpx;
					line-height: 40rpx;

					&_label {
						color: #666666;
						width: 120rpx;
						margin-right: 12rpx;
					}

					&_title {
						color: #111111;

						&_infos {
							display: flex;
							flex-wrap: wrap;
							align-items: center;

							&_name {
								font-weight: 700;
							}
							&_tag{
								margin-left:8rpx;
								padding:0 6rpx;
								color:#fff;
							}
							&_tag.tag4{
								background:#67c23a;
							}
                            &_tag.tag3{
								background:#7E61EF;
							}
							&_tag.tag2{
								background:#0FB6D2;
							}
							&_tag.tag1{
								background:#1E68E3;
							}
							&_line {
								width: 2rpx;
								height: 20rpx;
								background: rgba(168, 168, 168, 1);
								margin: 0 10rpx;
							}
						}
					}
				}
			}

		}

	
	}
</style>